home *** CD-ROM | disk | FTP | other *** search
/ MacHome 1999 Game / Image.bin / Role Playing and Strategy / Starbound II.hqx / Starbound II / AI agents / Gypsum.rsrc / ss$t_131 < prev    next >
Encoding:
Text File  |  1998-05-14  |  1.1 KB  |  33 lines

  1. situation planetary_bombardment_ship
  2. vars
  3.    p : planet;
  4.    s : structure;
  5.    a : integer;
  6.    weakest : structure;
  7.    bomb : integer;
  8.    success : boolean;
  9.  
  10. begin
  11.    // First see if the planet is an enemy race
  12.    if (Orbit_owner(This_planet()) <> Planet_race(This_planet())) then
  13.       begin
  14.          // Find a structure on the planet to bombard with the weakest armor
  15.          p := This_planet();
  16.          weakest := First_structure(p);
  17.          if (weakest <> nil) then
  18.             begin
  19.                s :=  Next_structure(p, weakest);
  20.                while (s <> nil) do
  21.                   begin
  22.                      if (Structure_armor(p, s) < Structure_armor(p, weakest)) then
  23.                         weakest := s;
  24.                      else if ((Structure_armor(p, s) = Structure_armor(p, weakest)) and
  25.                         (Random(4) = 0)) then
  26.                         weakest := s;
  27.                      s := Next_structure(p, s);
  28.                   end;
  29.                bomb := Structure_hex(p, weakest);
  30.                success := Bombard_planet(bomb);
  31.             end;
  32.       end;
  33. end;